﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DotSpatial.Controls;
using DotSpatial.Data;
using GeostatisticalTool.Classes;
namespace GeostatisticalTool.Forms
{
    public partial class OutputRaster : UserControl
    {
        private IMap map;
        private Extent ext;
        private string nameLayer;
        private Clip clip;

        public Clip Clip
        {
            get { return clip; }
            set { clip = value; }
        }

        public string NameLayer
        {
            get { return nameLayer; }
            set { nameLayer = value; }
        }

        
        public IMap Map
        {
            get { return map; }
            set { map = value; }
        }

        public Extent Ext
        {
            get { return ext; }
            set { ext = value; }
        }

        public string NameOutput
        {
            get { return uxName.Text; }
            set { uxName.Text = value; }
        }

        public string Path
        {
            get { return uxPathFile.Text; }
            set { uxPathFile.Text=value; }
        }

        public string Pixel
        {
            get { return uxPixelSize.Text; }
            set { uxPixelSize.Text = value; }
        }

        public OutputRaster()
        {
            InitializeComponent();
        }

        public void ConfigureOutput()
        {
            this.uxCreate.Text = "Associate field";
            this.label9.Visible = false;
            this.label10.Visible = false;
            this.label11.Visible = false;
            this.uxPathFile.Visible = false;
            this.uxSave.Visible = false;
            this.uxName.Visible = false;
            this.uxExtension.Visible = false;
            this.uxPixelSize.Visible = false;
        }

        public void OutputParameter()
        {
            this.uxCreate.Text = "Associate field";
            this.label9.Visible = false;
            this.label10.Visible = false;
            this.label11.Visible = false;
            this.uxPathFile.Visible = false;
            this.uxSave.Visible = false;
            this.uxName.Visible = false;
            this.uxExtension.Visible = false;
            this.uxPixelSize.Visible = false;
        }



        private void OutputRaster_Load(object sender, EventArgs e)
        {

        }

        private void uxSave_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();

            folderBrowserDialog1.Description =
           "Select folder where it will store the interpolation";
            folderBrowserDialog1.ShowNewFolderButton = false;
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                uxPathFile.Text = folderBrowserDialog1.SelectedPath + "\\";
            }
        }

        private void uxExtension_Click(object sender, EventArgs e)
        {
            DefineAreaStudy area = new DefineAreaStudy();
            area.SetMap(map, this.nameLayer);

            if (this.ext != null)
                area.Ext = this.ext;

            if (area.ShowDialog() == DialogResult.OK)
            {
                this.ext = area.Ext;
                this.clip = area.Clip;
            }
        }
    }
}
